Skip to content

Quality pass: IPC communication layer#90

Merged
dhilgaertner merged 2 commits intomainfrom
feature/crow-65-quality-pass-ipc
Apr 6, 2026
Merged

Quality pass: IPC communication layer#90
dhilgaertner merged 2 commits intomainfrom
feature/crow-65-quality-pass-ipc

Conversation

@dhilgaertner
Copy link
Copy Markdown
Contributor

@dhilgaertner dhilgaertner commented Apr 5, 2026

Summary

  • Fix partial write handling, add client read timeout (30s) and response size limit (1MB) to the Unix socket IPC layer
  • Fix 3 RPC handlers returning errors in result dict instead of proper JSON-RPC error responses
  • Add RPCErrorCoded protocol for typed error codes, doc comments, and missing JSONValue accessors
  • Add 32 tests covering protocol encoding, command routing, and real socket round-trips

Closes #65

Test plan

  • make build compiles cleanly
  • swift test --package-path Packages/CrowIPC — 32 tests pass
  • Manual smoke test: launch app, run crow list-sessions to confirm IPC works
  • Verify crow get-session --session <bad-uuid> returns proper RPC error

🤖 Generated with Claude Code

Fix correctness issues in the Unix socket IPC layer and add comprehensive
test coverage for the CrowIPC package.

Fixes:
- Handle partial writes in SocketServer and SocketClient (write loop)
- Add 30s read timeout to SocketClient via SO_RCVTIMEO
- Add 1MB response size limit to SocketClient matching server's request limit
- Fix 3 RPC handlers returning errors in result dict instead of proper
  JSON-RPC error responses (get-session, close-terminal)

Improvements:
- Add RPCErrorCoded protocol for typed error codes in CommandRouter
- Conform RPCError to RPCErrorCoded with correct code mapping
- Add missing doubleValue accessor, internalError code, Hashable on JSONValue
- Add doc comments to all public types
- Add new SocketError cases (writeFailed, readFailed, timeout, responseTooLarge)

Tests (32 passing):
- ProtocolTests: JSONValue round-trips, accessors, factories, error codes
- CommandRouterTests: routing, unknown methods, error propagation
- SocketRoundTripTests: real socket round-trips, large payloads, timeouts,
  oversized requests, permissions, invalid JSON

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dhilgaertner dhilgaertner requested a review from dgershman as a code owner April 5, 2026 21:57
@dhilgaertner dhilgaertner merged commit 673db1f into main Apr 6, 2026
2 checks passed
@dhilgaertner dhilgaertner deleted the feature/crow-65-quality-pass-ipc branch April 6, 2026 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quality Pass: IPC / Communication Layer

1 participant